#ifndef LOGINWIDGET_H
#define LOGINWIDGET_H

#include <QObject>
#include <QWidget>
#include <QDebug>
#include <QTcpSocket>
#include <QSettings>
#include <QMouseEvent>

//自定义的.h文件中的类声明
class MainWidget;
class RegistWidget;
class TcpSession;

QT_BEGIN_NAMESPACE
namespace Ui { class LoginWidget; }
QT_END_NAMESPACE

class LoginWidget : public QWidget
{
    Q_OBJECT

public:

    LoginWidget(TcpSession* session, QWidget *parent = nullptr);

    //UI函数
    void showPasswd();
    void hidePasswd();

private slots:
    //UI事件
    void on_pushButton_login_clicked();
    void on_pushButton_reg_clicked();
    void mousePressEvent(QMouseEvent *event) override;
    void mouseReleaseEvent(QMouseEvent *event) override;

    //从网络上收到数据
    void on_login_ret_signal(bool res, const QString & username, const QString & nickname);
private:
    Ui::LoginWidget *ui=nullptr;
    //本界面的通讯session
    TcpSession* session=nullptr;
    RegistWidget* registWidget=nullptr;
    MainWidget* mainWidget=nullptr;
};
#endif // LOGINWIDGET_H
